/*
 *英才会硕信息科技有限公司拥有本软件的版权，拥有本软件版权2025   并保留所有权利。
 *Copyright 2021,YCHS Information&Science Technology Co.,Ltd,
 *All rights reserved.
 */
package com.ychs.lawyerback01.controller;

import com.ychs.lawyerback01.common.R;
import com.ychs.lawyerback01.pojo.MenuEntity;
import com.ychs.lawyerback01.service.MenuService;
import com.ychs.lawyerback01.vo.MenuQueryVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author xuehongjin
 * @version 1.0
 * @date 2025/8/18
 */
@RestController
@RequestMapping("/menu")
public class MenuController {
    @Autowired
    private MenuService menuService;

    @GetMapping("/getMenusByUserId/{userId}")
   public R<?> getMenusByUserId(@PathVariable Long userId){
     List<MenuQueryVo> menus =  menuService.getMenusByUserId(userId);
     return R.success(menus);

   }
    @GetMapping("/getAllMenus")
    public R getAllMenus() {
        List<MenuEntity> menus = menuService.getAllMenus();
        return R.success(menus);
    }
}
